AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

include('shared.lua')

function ENT:FakeInit()
	self.Entity:PhysicsInitSphere( 30 )
    self.Entity:SetMoveType( MOVETYPE_NONE )
    self.Entity:SetSolid( SOLID_VPHYSICS )
    self.Entity:SetTrigger( true )

	self.NextTouch = {}
end

function ENT:Touch( ply )
	//Is it a valid player?
	if !IsValid( ply ) then return end
	if !ply:IsPlayer() then return end
	
	//Does the setting say it is only for team-mates?
	if NicanSettings.JumpPadTeamOnly then
		if ply:Team() != self:GetTeam() then
			return
		end
	end
	
	//Have he jumped twice?
	if CurTime() < (self.NextTouch[ ply ] or 0) then return end
	
	self.NextTouch[ ply ] = CurTime() + NicanSettings.JumpPadDelay
	
	local NewVelocity = self:GetUp() * NicanSettings.JumpPadSentrngh + Vector(0,0,100)
	
	Msg( tostring(NewVelocity) .. "\n")
	
	ply:SetVelocity(NewVelocity)
end